<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
</head>
<body>
<form>
    登录名:<input id="name" name="name" type="text"><br>
    <button onclick="btn()">登录</button>
    <input type="reset" value="清空">
    <script type="text/javascript">
        function btn() {
            var name;
            name = document.getElementById("name").value;
            var reg = /^(?=.*[a-zA-Z0-9])(?=.*\d)(?=.*[~!@ #$%^&*()_+`\-={}:";'<>?,.\/]).{8,64}$/;
            if (reg.test(name)) {
                alert("登录成功，满足正则表达式")
                return
            }
            alert("登录失败，不满足正则表达式")
        }
    </script>
</form>
</body>
</html>